
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.2.2 进程通信 · Ebook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="zq_sdk@163.com">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tree/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="thread.html" />
    
    
    <link rel="prev" href="oop.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"TIME-GATE/","types":["star","watch"],"size":"large"};
    </script>

    
    <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chart/c3/c3.min.css">
    <script src="../../gitbook/gitbook-plugin-chart/c3/d3.min.js"></script>
    <script src="../../gitbook/gitbook-plugin-chart/c3/c3.min.js"></script>
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../../about_me.html">
            
                <a href="../../about_me.html">
            
                    
                    关于
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../../gitbook_install.html">
            
                <a href="../../gitbook_install.html">
            
                    
                    附:Gitbook安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../">
            
                <a href="../../">
            
                    
                    一 基础理论
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../data_structure/">
            
                <a href="../../data_structure/">
            
                    
                    1 数据结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../../data_structure/11_linear_structure.html">
            
                <a href="../../data_structure/11_linear_structure.html">
            
                    
                    1.1 数组、链表、跳表及字典
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1.1" data-path="../../data_structure/111_array.html">
            
                <a href="../../data_structure/111_array.html">
            
                    
                    1.1.1 数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.2" data-path="../../data_structure/112_link_list.html">
            
                <a href="../../data_structure/112_link_list.html">
            
                    
                    1.1.2 链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.3" data-path="../../data_structure/113_skip_list.html">
            
                <a href="../../data_structure/113_skip_list.html">
            
                    
                    1.1.3 跳表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.1.4" data-path="../../data_structure/114_dictionary.html">
            
                <a href="../../data_structure/114_dictionary.html">
            
                    
                    1.1.4 字典
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../../data_structure/12_stack_and_queue.html">
            
                <a href="../../data_structure/12_stack_and_queue.html">
            
                    
                    1.2 栈、队列、散列及集合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.2.1" data-path="../../data_structure/121_stack.html">
            
                <a href="../../data_structure/121_stack.html">
            
                    
                    1.2.1 栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.2" data-path="../../data_structure/122_queue.html">
            
                <a href="../../data_structure/122_queue.html">
            
                    
                    1.2.2 队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.3" data-path="../../data_structure/123_hash.html">
            
                <a href="../../data_structure/123_hash.html">
            
                    
                    1.2.3 散列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2.4" data-path="../../data_structure/124_set.html">
            
                <a href="../../data_structure/124_set.html">
            
                    
                    1.2.4 集合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../../data_structure/13_tree_and_forest.html">
            
                <a href="../../data_structure/13_tree_and_forest.html">
            
                    
                    1.3 树与森林
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.3.1" data-path="../../data_structure/131.html">
            
                <a href="../../data_structure/131.html">
            
                    
                    1.3.1 二叉搜索树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3.2" data-path="../../data_structure/132.html">
            
                <a href="../../data_structure/132.html">
            
                    
                    1.3.2 红黑树
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../../data_structure/14_map.html">
            
                <a href="../../data_structure/14_map.html">
            
                    
                    1.4 图结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.4.1" data-path="../../data_structure/141_minimal_tree.html">
            
                <a href="../../data_structure/141_minimal_tree.html">
            
                    
                    1.4.1 最小生成树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.2" data-path="../../data_structure/142_single_source_shortest_path.html">
            
                <a href="../../data_structure/142_single_source_shortest_path.html">
            
                    
                    1.4.2 单源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.3" data-path="../../data_structure/143_all_source_shortest_path.html">
            
                <a href="../../data_structure/143_all_source_shortest_path.html">
            
                    
                    1.4.3 多源最短路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4.4" data-path="../../data_structure/144_max_stream.html">
            
                <a href="../../data_structure/144_max_stream.html">
            
                    
                    1.4.4 最大流
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../">
            
                <a href="../../">
            
                    
                    2 基础算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../../algorithm/21.html">
            
                <a href="../../algorithm/21.html">
            
                    
                    2.1 排序查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../../algorithm/22.html">
            
                <a href="../../algorithm/22.html">
            
                    
                    2.2 动态规划
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../algorithm/distributed_algorithm.html">
            
                <a href="../../algorithm/distributed_algorithm.html">
            
                    
                    3 分布式算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.3.1" data-path="../../engineering/ci_deplopment/cs/theory.html">
            
                <a href="../../engineering/ci_deplopment/cs/theory.html">
            
                    
                    3.1 一致性模式与理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.2" data-path="../../algorithm/raft.html">
            
                <a href="../../algorithm/raft.html">
            
                    
                    3.2 Raft协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.3" data-path="../../algorithm/paxos.html">
            
                <a href="../../algorithm/paxos.html">
            
                    
                    3.3 Paxos协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.4" data-path="../../algorithm/gossip.html">
            
                <a href="../../algorithm/gossip.html">
            
                    
                    3.4 Gossip协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3.5" data-path="../../engineering/ci_deplopment/cs/plan.html">
            
                <a href="../../engineering/ci_deplopment/cs/plan.html">
            
                    
                    3.5 几种一致性方案
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../optimization_se/">
            
                <a href="../../optimization_se/">
            
                    
                    4 运筹及系统工程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../../optimization_se/linear_programming.html">
            
                <a href="../../optimization_se/linear_programming.html">
            
                    
                    4.1 线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../../optimization_se/integer_programming.html">
            
                <a href="../../optimization_se/integer_programming.html">
            
                    
                    4.2 整数规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.3" data-path="../../optimization_se/目标规划.html">
            
                <a href="../../optimization_se/目标规划.html">
            
                    
                    4.3 目标规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.4" data-path="../../optimization_se/非线性规划.html">
            
                <a href="../../optimization_se/非线性规划.html">
            
                    
                    4.4 非线性规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.5" data-path="../../optimization_se/动态规划.html">
            
                <a href="../../optimization_se/动态规划.html">
            
                    
                    4.5 动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.6" data-path="../../optimization_se/排队论.html">
            
                <a href="../../optimization_se/排队论.html">
            
                    
                    4.6 排队论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.7" data-path="../../optimization_se/博弈论.html">
            
                <a href="../../optimization_se/博弈论.html">
            
                    
                    4.7 博弈论
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    二 工程应用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../engineering/design_pattern/">
            
                <a href="../../engineering/design_pattern/">
            
                    
                    1 设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../../engineering/design_pattern/strategy.html">
            
                <a href="../../engineering/design_pattern/strategy.html">
            
                    
                    1.1 策略模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../../engineering/design_pattern/prototype.html">
            
                <a href="../../engineering/design_pattern/prototype.html">
            
                    
                    1.2 原型模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.3" data-path="../../engineering/design_pattern/singleton.html">
            
                <a href="../../engineering/design_pattern/singleton.html">
            
                    
                    1.3 单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.4" data-path="../../engineering/design_pattern/factory.html">
            
                <a href="../../engineering/design_pattern/factory.html">
            
                    
                    1.4 工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.5" data-path="../../engineering/design_pattern/bridge.html">
            
                <a href="../../engineering/design_pattern/bridge.html">
            
                    
                    1.5 桥接模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.6" data-path="../../engineering/design_pattern/composite.html">
            
                <a href="../../engineering/design_pattern/composite.html">
            
                    
                    1.6 组合模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.7" data-path="../../engineering/design_pattern/facade.html">
            
                <a href="../../engineering/design_pattern/facade.html">
            
                    
                    1.7 门面模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.8" data-path="../../engineering/design_pattern/adapter.html">
            
                <a href="../../engineering/design_pattern/adapter.html">
            
                    
                    1.8 适配器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.9" data-path="../../engineering/design_pattern/decorator.html">
            
                <a href="../../engineering/design_pattern/decorator.html">
            
                    
                    1.9 装饰者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.10" data-path="../../engineering/design_pattern/flyweight.html">
            
                <a href="../../engineering/design_pattern/flyweight.html">
            
                    
                    1.10 享元模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.11" data-path="../../engineering/design_pattern/proxy.html">
            
                <a href="../../engineering/design_pattern/proxy.html">
            
                    
                    1.11 代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.12" data-path="../../engineering/design_pattern/middleware.html">
            
                <a href="../../engineering/design_pattern/middleware.html">
            
                    
                    1.12 中间件模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../engineering/network_prag/">
            
                <a href="../../engineering/network_prag/">
            
                    
                    2 网络编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../../engineering/network_prag/socket.html">
            
                <a href="../../engineering/network_prag/socket.html">
            
                    
                    2.1 长连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../../engineering/network_prag/mq.html">
            
                <a href="../../engineering/network_prag/mq.html">
            
                    
                    2.2 MQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../">
            
                <a href="../">
            
                    
                    3 语言应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../nodejs/node.html">
            
                <a href="../nodejs/node.html">
            
                    
                    3.1 Node.js
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1.1" data-path="../nodejs/core.html">
            
                <a href="../nodejs/core.html">
            
                    
                    3.1.1 原理及构成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.2" data-path="../nodejs/async.html">
            
                <a href="../nodejs/async.html">
            
                    
                    3.1.2 异步机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.3" data-path="../nodejs/important.html">
            
                <a href="../nodejs/important.html">
            
                    
                    3.1.3 一些核心概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.4" data-path="../nodejs/koa_web.html">
            
                <a href="../nodejs/koa_web.html">
            
                    
                    3.1.4 web应用: koa框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.5" data-path="../nodejs/koa.html">
            
                <a href="../nodejs/koa.html">
            
                    
                    3.1.5 koa源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.6" data-path="../nodejs/libuv.html">
            
                <a href="../nodejs/libuv.html">
            
                    
                    3.1.6 libuv网络库应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.7" data-path="../nodejs/apm.html">
            
                <a href="../nodejs/apm.html">
            
                    
                    3.1.7 性能调优
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.8" data-path="../nodejs/node_spider.html">
            
                <a href="../nodejs/node_spider.html">
            
                    
                    3.1.8 其他: Node爬虫
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.1.9" data-path="../nodejs/node_map_reduce.html">
            
                <a href="../nodejs/node_map_reduce.html">
            
                    
                    3.1.9 其他: Node编写Mapreduce
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="c_and_plus.html">
            
                <a href="c_and_plus.html">
            
                    
                    3.2 C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.2.1" data-path="oop.html">
            
                <a href="oop.html">
            
                    
                    3.2.1 面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.3.2.2" data-path="ipcs.html">
            
                <a href="ipcs.html">
            
                    
                    3.2.2 进程通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.3" data-path="thread.html">
            
                <a href="thread.html">
            
                    
                    3.2.3 线程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.4" data-path="memory.html">
            
                <a href="memory.html">
            
                    
                    3.2.4 内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.5" data-path="network.html">
            
                <a href="network.html">
            
                    
                    3.2.5 网络编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.6" data-path="build_tool.html">
            
                <a href="build_tool.html">
            
                    
                    3.2.6 构建工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2.7" data-path="thread_pool.html">
            
                <a href="thread_pool.html">
            
                    
                    3.2.7 其他: 线程池
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../engineering/ci_deplopment/">
            
                <a href="../../engineering/ci_deplopment/">
            
                    
                    三 搭建部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../engineering/ci_deplopment/test.html">
            
                <a href="../../engineering/ci_deplopment/test.html">
            
                    
                    3.1 测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../engineering/ci_deplopment/test/unit_testing.html">
            
                <a href="../../engineering/ci_deplopment/test/unit_testing.html">
            
                    
                    3.1.1 单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../engineering/ci_deplopment/test/stress_testing.html">
            
                <a href="../../engineering/ci_deplopment/test/stress_testing.html">
            
                    
                    3.1.2 压力测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../engineering/ci_deplopment/ci_readme.html">
            
                <a href="../../engineering/ci_deplopment/ci_readme.html">
            
                    
                    3.2 集成
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../../engineering/ci_deplopment/ci/gitlab_ci.html">
            
                <a href="../../engineering/ci_deplopment/ci/gitlab_ci.html">
            
                    
                    3.2.1 GitLab CI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../../engineering/ci_deplopment/ci/spinnaker.html">
            
                <a href="../../engineering/ci_deplopment/ci/spinnaker.html">
            
                    
                    3.2.2 Spinnaker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../engineering/ci_deplopment/build.html">
            
                <a href="../../engineering/ci_deplopment/build.html">
            
                    
                    3.3 部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.3.1" data-path="../../engineering/ci_deplopment/k8s/k8s.html">
            
                <a href="../../engineering/ci_deplopment/k8s/k8s.html">
            
                    
                    3.3.1 k8s
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.2" data-path="../../engineering/ci_deplopment/rancher/rancher.html">
            
                <a href="../../engineering/ci_deplopment/rancher/rancher.html">
            
                    
                    3.3.2 rancher
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3.3" data-path="../../engineering/ci_deplopment/swarm/swarm.html">
            
                <a href="../../engineering/ci_deplopment/swarm/swarm.html">
            
                    
                    3.3.3 swarm
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../engineering/ci_deplopment/maintenance.html">
            
                <a href="../../engineering/ci_deplopment/maintenance.html">
            
                    
                    3.4 监控
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.4.1" data-path="../../engineering/ci_deplopment/monitor.html">
            
                <a href="../../engineering/ci_deplopment/monitor.html">
            
                    
                    3.4.1 容器监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.2" data-path="../../engineering/ci_deplopment/trace.html">
            
                <a href="../../engineering/ci_deplopment/trace.html">
            
                    
                    3.4.2 系统监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4.3" data-path="../../engineering/ci_deplopment/app1.md">
            
                <span>
            
                    
                    3.4.2 应用监控
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../engineering/ha/ha.html">
            
                <a href="../../engineering/ha/ha.html">
            
                    
                    3.5 高可用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.5.1" data-path="../../engineering/ha/client.html">
            
                <a href="../../engineering/ha/client.html">
            
                    
                    3.5.1 接入层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.2" data-path="../../engineering/ha/service.html">
            
                <a href="../../engineering/ha/service.html">
            
                    
                    3.5.2 服务层高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5.3" data-path="../../engineering/ha/share.html">
            
                <a href="../../engineering/ha/share.html">
            
                    
                    3.5.3 存储层高可用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../../engineering/ci_deplopment/hc/hc.html">
            
                <a href="../../engineering/ci_deplopment/hc/hc.html">
            
                    
                    3.6 高并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.6.1" data-path="../../engineering/ci_deplopment/hc/dns.html">
            
                <a href="../../engineering/ci_deplopment/hc/dns.html">
            
                    
                    3.6.1 基于DNS的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.2" data-path="../../engineering/ci_deplopment/hc/lvs.html">
            
                <a href="../../engineering/ci_deplopment/hc/lvs.html">
            
                    
                    3.6.2 基于Lvs的负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6.3" data-path="../../engineering/ci_deplopment/hc/haproxy.html">
            
                <a href="../../engineering/ci_deplopment/hc/haproxy.html">
            
                    
                    3.6.3 基于haproxy的负载均衡
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    四 架构模式
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    1 微服务架构设计与实践
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../java/spring-cloud.html">
            
                <a href="../java/spring-cloud.html">
            
                    
                    1.1 微服务概况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../java/spring-eureka.html">
            
                <a href="../java/spring-eureka.html">
            
                    
                    1.2 服务注册及发现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="../java/spring-feign.html">
            
                <a href="../java/spring-feign.html">
            
                    
                    1.3 服务调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.4" data-path="../java/spring-zuul.html">
            
                <a href="../java/spring-zuul.html">
            
                    
                    1.4 网关及负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.5" data-path="../java/spring-hystrix.html">
            
                <a href="../java/spring-hystrix.html">
            
                    
                    1.5 熔断、限流、扩缩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.6" data-path="../java/spring-config.html">
            
                <a href="../java/spring-config.html">
            
                    
                    1.6 云配置中心
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.7" data-path="../java/zipkin-tracing.html">
            
                <a href="../java/zipkin-tracing.html">
            
                    
                    1.7 分布式链路追踪
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.8" data-path="../java/swagger.html">
            
                <a href="../java/swagger.html">
            
                    
                    1.8 接口文档管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../domain/">
            
                <a href="../../domain/">
            
                    
                    2 领域驱动模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="../../domain/domain.html">
            
                <a href="../../domain/domain.html">
            
                    
                    2.1 领域--Domain
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="../../domain/entity.md">
            
                <span>
            
                    
                    2.2 领域实体--Entity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="../../domain/object.html">
            
                <a href="../../domain/object.html">
            
                    
                    2.3 值对象--Value Object
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.4" data-path="../../domain/aggregate.html">
            
                <a href="../../domain/aggregate.html">
            
                    
                    2.4 聚合--Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.5" data-path="../../domain/service.html">
            
                <a href="../../domain/service.html">
            
                    
                    2.5 服务--Services
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.6" data-path="../../domain/event.html">
            
                <a href="../../domain/event.html">
            
                    
                    2.6 领域事件--Event
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.7" data-path="../../domain/framework.html">
            
                <a href="../../domain/framework.html">
            
                    
                    2.7 几种常见的DDD架构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    3 架构技术的演化与趋势
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.3.1" >
            
                <span>
            
                    
                    3.1 架构技术的发展历史及现状
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.2" >
            
                <span>
            
                    
                    3.2 Serverless无服务架构概念
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.3" >
            
                <span>
            
                    
                    3.3 ServerMesh网格服务概念
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    五 其他
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../story/talk.html">
            
                <a href="../../story/talk.html">
            
                    
                    5.1 小伙子,放松!
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >3.2.2 进程通信</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x4E00;&#x3001;&#x7B80;&#x4ECB;">&#x4E00;&#x3001;&#x7B80;&#x4ECB;</h3>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x8FDB;&#x7A0B;&#x662F;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E3A;&#x7A0B;&#x5E8F;&#x63D0;&#x4F9B;&#x7684;&#x91CD;&#x8981;&#x8FD0;&#x884C;&#x73AF;&#x5883;&#x62BD;&#x8C61;&#xFF0C;&#x662F;&#x7CFB;&#x7EDF;&#x8FDB;&#x884C;&#x8D44;&#x6E90;&#x5206;&#x914D;&#x548C;&#x8C03;&#x5EA6;&#x7684;&#x57FA;&#x672C;&#x5355;&#x4F4D;&#xFF0C;&#x5176;&#x5728;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x5185;&#x901A;&#x5E38;&#x6709;&#x5C31;&#x7EEA;&#x3001;&#x963B;&#x585E;&#x3001;&#x8FD0;&#x884C;&#x4E09;&#x79CD;&#x72B6;&#x6001;&#xFF0C;&#x8FDB;&#x7A0B;&#x62E5;&#x6709;&#x72EC;&#x7ACB;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF0C;&#x4E0D;&#x540C;&#x8FDB;&#x7A0B;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#x65B9;&#x5F0F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7BA1;&#x9053;&#x3001;&#x961F;&#x5217;&#x3001;&#x5171;&#x4EAB;&#x5B58;&#x50A8;&#x3001;&#x4FE1;&#x53F7;&#x3001;&#x4FE1;&#x53F7;&#x91CF;&#x3001;&#x5957;&#x63A5;&#x5B57;&#x7B49;&#xFF0C;&#x5176;&#x4E2D;&#x5171;&#x4EAB;&#x5B58;&#x50A8;&#x7684;&#x65B9;&#x5F0F;&#x907F;&#x514D;&#x4E86;&#x5185;&#x5B58;&#x62F7;&#x8D1D;&#xFF0C;&#x4E5F;&#x662F;&#x6700;&#x5FEB;&#x6700;&#x5E38;&#x7528;&#x7684;&#x4E00;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x672C;&#x7AE0;&#x8282;&#x91CD;&#x70B9;&#x5206;&#x4EAB;&#x7531;&#x5171;&#x4EAB;&#x5B58;&#x50A8;&#x53CA;&#x4FE1;&#x53F7;&#x91CF;&#x6784;&#x6210;&#x7684;&#x8FDB;&#x7A0B;&#x5B89;&#x5168;&#x901A;&#x4FE1;&#xFF0C;&#x5E76;&#x4EE5;&#x5171;&#x4EAB;&#x65E5;&#x5FD7;&#x7684;&#x5F62;&#x5F0F;&#x505A;&#x573A;&#x666F;&#x5B9E;&#x73B0;&#x3002;</p>
<ul>
<li>1.1 Linux&#x4E0B;&#x5171;&#x4EAB;&#x5B58;&#x50A8;&#x51FD;&#x6570;&#x539F;&#x578B;</li>
</ul>
<pre><code class="lang-c++"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/shm.h&gt;</span></span>

<span class="hljs-comment">/** 1&#x3001;&#x521B;&#x5EFA;
 * @params{key_t}:  key &#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6807;&#x8BC6;&#x7B26;
 * @params{size_t}: size &#x5171;&#x4EAB;&#x7684;&#x5185;&#x5B58;&#x5BB9;&#x91CF;
 * @params{int}: shmflg &#x6743;&#x9650;&#x6807;&#x5FD7;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">shmget</span><span class="hljs-params">(key_t key, size_t size, <span class="hljs-keyword">int</span> shmflg)</span>

<span class="hljs-comment">/** 2&#x3001;&#x8FDE;&#x63A5;
 * @params{int}:  shm_id shmget()&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6807;&#x8BC6;
 * @params{void}: shm_addr &#x5171;&#x4EAB;&#x5185;&#x5B58;&#x8FDE;&#x63A5;&#x5230;&#x5F53;&#x524D;&#x8FDB;&#x7A0B;&#x4E2D;&#x7684;&#x5730;&#x5740;&#x4F4D;&#x7F6E;
 * @params{int}: shmflg &#x6807;&#x5FD7;&#x4F4D;&#xFF0C;&#x901A;&#x5E38;&#x4E3A;0
 */</span>
<span class="hljs-keyword">void</span> *<span class="hljs-title">shmat</span><span class="hljs-params">(<span class="hljs-keyword">int</span> shm_id, <span class="hljs-keyword">const</span> <span class="hljs-keyword">void</span> *shm_addr, <span class="hljs-keyword">int</span> shmflg)</span></span>;

<span class="hljs-comment">/** 3&#x3001;&#x5206;&#x79BB;
 * @params{void}: shmaddr shmat()&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x5730;&#x5740;&#x6307;&#x9488;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">shmdt</span><span class="hljs-params">(<span class="hljs-keyword">const</span> <span class="hljs-keyword">void</span> *shmaddr)</span></span>;

<span class="hljs-comment">/** 4&#x3001;&#x63A7;&#x5236;
  @params{int}:  shm_id shmget()&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x7684;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6807;&#x8BC6;
  @params{int}: command &#x8981;&#x91C7;&#x53D6;&#x7684;&#x64CD;&#x4F5C;
    ==&gt; IPC_STAT: &#x7528;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x7684;&#x5F53;&#x524D;&#x5173;&#x8054;&#x503C;&#x8986;&#x76D6;shmid_ds&#x7684;&#x503C;
    ==&gt; IPC_SET: &#x628A;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x7684;&#x5F53;&#x524D;&#x5173;&#x8054;&#x503C;&#x8BBE;&#x7F6E;&#x4E3A;shmid_ds&#x7ED3;&#x6784;&#x4E2D;&#x7ED9;&#x51FA;&#x7684;&#x503C;
    ==&gt; IPC_RMID: &#x5220;&#x9664;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6BB5;
  @params{struct}: buf &#x5171;&#x4EAB;&#x5185;&#x5B58;&#x6A21;&#x5F0F;&#x548C;&#x8BBF;&#x95EE;&#x6743;&#x9650;&#x7684;&#x7ED3;&#x6784;, &#x4E00;&#x822C;&#x5982;&#x4E0B;:
  struct shmid_ds {
    uid_t shm_perm.uid;
    uid_t shm_perm.gid;
    mode_t shm_perm.mode;
  }
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">shmctl</span><span class="hljs-params">(<span class="hljs-keyword">int</span> shm_id, <span class="hljs-keyword">int</span> command, <span class="hljs-keyword">struct</span> shmid_ds *buf)</span></span>;
</code></pre>
<ul>
<li>1.2 Linux&#x4E0B;&#x4FE1;&#x53F7;&#x91CF;&#x51FD;&#x6570;&#x539F;&#x578B;</li>
</ul>
<pre><code class="lang-c++"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span><span class="hljs-meta-string">&lt;sys/sem.h&gt;</span></span>

<span class="hljs-comment">/** 1&#x3001;&#x521B;&#x5EFA;
 * @params{key_t}:  key &#x4EE3;&#x8868;&#x7A0B;&#x5E8F;&#x53EF;&#x80FD;&#x8981;&#x4F7F;&#x7528;&#x7684;&#x67D0;&#x4E2A;&#x8D44;
 * @params{int}: num_sems &#x9700;&#x8981;&#x7684;&#x4FE1;&#x53F7;&#x91CF;&#x6570;&#x76EE;
 * @params{int}: sem_flags &#x6807;&#x5FD7;&#x4F4D;
 *  ==&gt; IPC_CREAT: &#x5982;&#x679C;&#x4FE1;&#x53F7;&#x91CF;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x4FE1;&#x53F7;&#x91CF;&#xFF0C;&#x5426;&#x5219;&#x83B7;&#x53D6;
 *  ==&gt; IPC_EXCL: &#x53EA;&#x6709;&#x4FE1;&#x53F7;&#x91CF;&#x4E0D;&#x5B58;&#x5728;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x65B0;&#x7684;&#x4FE1;&#x53F7;&#x91CF;&#x624D;&#x5EFA;&#x7ACB;&#xFF0C;&#x5426;&#x5219;&#x5C31;&#x4EA7;&#x751F;&#x9519;&#x8BEF;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">semget</span><span class="hljs-params">(key_t key, <span class="hljs-keyword">int</span> num_sems, <span class="hljs-keyword">int</span> sem_flags)</span></span>;

<span class="hljs-comment">/** 2&#x3001;&#x64CD;&#x4F5C;
 * @params{key_t}:  sem_id semget()&#x7684;&#x8FD4;&#x56DE;&#x503C;
 * @params{struct}: sem_opa &#x6307;&#x5411;&#x7ED3;&#x6784;&#x4F53;&#x6570;&#x7EC4;&#x7684;&#x6307;&#x9488;
 * @params{size_t}: num_sem_ops &#x64CD;&#x4F5C;&#x7ED3;&#x6784;&#x7684;&#x6570;&#x91CF;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">semop</span><span class="hljs-params">(<span class="hljs-keyword">int</span> sem_id, <span class="hljs-keyword">struct</span> sembuf *sem_opa, size_t num_sem_ops)</span></span>;

<span class="hljs-comment">/** 3&#x3001;&#x63A7;&#x5236;
 * @params{keinty_t}:  sem_id semget()&#x7684;&#x8FD4;&#x56DE;&#x503C;
 * @params{int}: sem_num &#x64CD;&#x4F5C;&#x4FE1;&#x53F7;&#x5728;&#x4FE1;&#x53F7;&#x96C6;&#x4E2D;&#x7684;&#x7F16;&#x53F7;
 * @params{int}: command &#x60F3;&#x8981;&#x8FDB;&#x884C;&#x7684;&#x64CD;&#x4F5C;
 *  ==&gt; IPC_STAT&#x8BFB;&#x53D6;&#x4E00;&#x4E2A;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;semid_ds&#xFF0C;&#x5E76;&#x5C06;&#x5176;&#x5B58;&#x50A8;&#x5728;semun&#x4E2D;&#x7684;buf&#x53C2;&#x6570;&#x4E2D;&#x3002;
 *  ==&gt; IPC_SET &#x8BBE;&#x7F6E;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;semid_ds&#x4E2D;&#x7684;&#x5143;&#x7D20;ipc_perm&#xFF0C;&#x5176;&#x503C;&#x53D6;&#x81EA;semun&#x4E2D;&#x7684;buf&#x53C2;&#x6570;&#x3002;
 *  ==&gt; IPC_RMID&#x5C06;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x4ECE;&#x5185;&#x5B58;&#x4E2D;&#x5220;&#x9664;&#x3002;
 *  ==&gt; GETALL &#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x4FE1;&#x53F7;&#x91CF;&#x7684;&#x503C;&#x3002;
 *  ==&gt; GETNCNT &#x8FD4;&#x56DE;&#x6B63;&#x5728;&#x7B49;&#x5F85;&#x8D44;&#x6E90;&#x7684;&#x8FDB;&#x7A0B;&#x6570;&#x76EE;&#x3002;
 *  ==&gt; GETPID &#x8FD4;&#x56DE;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x6267;&#x884C;semop&#x64CD;&#x4F5C;&#x7684;&#x8FDB;&#x7A0B;&#x7684;PID&#x3002;
 *  ==&gt; GETVAL &#x8FD4;&#x56DE;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x5355;&#x4E2A;&#x7684;&#x4FE1;&#x53F7;&#x91CF;&#x7684;&#x503C;&#x3002;
 *  ==&gt; GETZCNT &#x8FD4;&#x56DE;&#x8FD9;&#x5728;&#x7B49;&#x5F85;&#x5B8C;&#x5168;&#x7A7A;&#x95F2;&#x7684;&#x8D44;&#x6E90;&#x7684;&#x8FDB;&#x7A0B;&#x6570;&#x76EE;&#x3002;
 *  ==&gt; SETALL &#x8BBE;&#x7F6E;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x7684;&#x4FE1;&#x53F7;&#x91CF;&#x7684;&#x503C;&#x3002;
 *  ==&gt; SETVAL &#x8BBE;&#x7F6E;&#x4FE1;&#x53F7;&#x91CF;&#x96C6;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x5355;&#x72EC;&#x7684;&#x4FE1;&#x53F7;&#x91CF;&#x7684;&#x503C;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">semctl</span><span class="hljs-params">(<span class="hljs-keyword">int</span> sem_id, <span class="hljs-keyword">int</span> sem_num, <span class="hljs-keyword">int</span> command, ...)</span></span>;
</code></pre>
<hr>
<h3 id="&#x4E8C;&#x3001;&#x5E94;&#x7528;">&#x4E8C;&#x3001;&#x5E94;&#x7528;</h3>
<p>&#xA0;&#xA0;&#xA0;&#xA0;&#x5047;&#x8BBE;&#x6709;&#x5982;&#x4E0B;&#x573A;&#x666F;&#xFF1A;&#x670D;&#x52A1;&#x5668;&#x9700;&#x8981;&#x8BB0;&#x5F55;&#x6C47;&#x603B;&#x5F53;&#x524D;&#x591A;&#x4E2A;&#x76F8;&#x540C;&#x670D;&#x52A1;&#x8FDB;&#x7A0B;&#x7684;&#x5BC6;&#x96C6;&#x8BFB;&#x5199;&#x64CD;&#x4F5C;&#x65E5;&#x5FD7;&#xFF0C;&#x4E3A;&#x907F;&#x514D;&#x76F4;&#x63A5;&#x5C06;&#x65E5;&#x5FD7;&#x8BB0;&#x5F55;&#x5230;&#x786C;&#x76D8;&#xFF0C;&#x9700;&#x8981;&#x9884;&#x5148;&#x5206;&#x914D;&#x4E00;&#x5757;&#x5185;&#x5B58;&#x4F5C;&#x4E3A;&#x7F13;&#x51B2;&#x533A;&#xFF0C;&#x591A;&#x4E2A;&#x8FDB;&#x7A0B;&#x5171;&#x4EAB;&#x8BE5;&#x7F13;&#x51B2;&#x533A;&#xFF0C;&#x4E14;&#x8981;&#x4FDD;&#x8BC1;&#x5B89;&#x5168;&#x8BFB;&#x5199;&#xFF0C;&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x7528;&#x5230;&#x4FE1;&#x53F7;&#x91CF;&#x6765;&#x4FDD;&#x8BC1;&#x5BF9;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x505A;&#x5E76;&#x53D1;&#x63A7;&#x5236;&#xFF0C;&#x8BBE;&#x8BA1;&#x4E0E;&#x5B9E;&#x73B0;&#x5982;&#x4E0B;:</p>
<ul>
<li>2.1 &#x5171;&#x4EAB;&#x5185;&#x5B58;&#x7C7B;&#x5B9E;&#x73B0;</li>
</ul>
<pre><code class="lang-cpp"><span class="hljs-comment">/* &#x5171;&#x4EAB;&#x5185;&#x5B58;&#x5934;&#x6587;&#x4EF6; */</span>

<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/time.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/types.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/ipc.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/sem.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/shm.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sys/stat.h&gt;</span></span>

<span class="hljs-keyword">class</span> CShmem {

  <span class="hljs-keyword">public</span>:

    CShmem(<span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> * keyfile);
    ~CShmem();

  <span class="hljs-keyword">public</span>:

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">alloc</span><span class="hljs-params">(size_t size)</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">free</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> * <span class="hljs-title">link</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">unlink</span><span class="hljs-params">(<span class="hljs-keyword">void</span> * ptr)</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">isOwner</span><span class="hljs-params">()</span> <span class="hljs-keyword">const</span></span>;

  <span class="hljs-keyword">private</span>:

    <span class="hljs-keyword">bool</span> m_IsOwner;

    <span class="hljs-keyword">int32_t</span> m_ShmId;

    <span class="hljs-built_in">std</span>::<span class="hljs-built_in">string</span> m_Keyfile;
};

<span class="hljs-keyword">class</span> CSemlock {

  <span class="hljs-keyword">public</span>:

    CSemlock(<span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> * keyfile);
    ~CSemlock();

  <span class="hljs-keyword">public</span>:

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">init</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">final</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">lock</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">unlock</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">isOwner</span><span class="hljs-params">()</span> <span class="hljs-keyword">const</span></span>;

  <span class="hljs-keyword">private</span>:

    <span class="hljs-keyword">bool</span> m_IsOwner;

    <span class="hljs-keyword">int32_t</span> m_SemId;

    <span class="hljs-built_in">std</span>::<span class="hljs-built_in">string</span> m_Keyfile;
};

<span class="hljs-comment">/* CShmem */</span>

CShmem::CShmem( <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> * keyfile )
  : m_IsOwner(<span class="hljs-literal">true</span>),
    m_ShmId(<span class="hljs-number">-1</span>),
    m_Keyfile(keyfile)
{}

CShmem::~CShmem() {}

<span class="hljs-keyword">bool</span> CShmem::alloc(<span class="hljs-keyword">size_t</span> size) {
  <span class="hljs-keyword">key_t</span> shmkey = <span class="hljs-number">-1</span>;
  <span class="hljs-keyword">int32_t</span> projectid = <span class="hljs-number">0</span>;

  <span class="hljs-keyword">if</span>(m_Keyfile.empty()) {
    m_ShmId = ::shmget(IPC_PRIVATE, size, IPC_CREAT);
    <span class="hljs-keyword">goto</span> ALLOCATE_RESULT;
  }

  projectid = (<span class="hljs-keyword">int32_t</span>)HashFunction::djb(m_Keyfile.c_str(), m_Keyfile.length());
  shmkey = ::ftok(<span class="hljs-keyword">const_cast</span>&lt;<span class="hljs-keyword">char</span> *&gt;(m_Keyfile.c_str()), projectid);

  <span class="hljs-keyword">if</span>(shmkey == <span class="hljs-number">-1</span>) {
    <span class="hljs-keyword">goto</span> ALLOCATE_RESULT;
  }

  m_ShmId = ::shmget(shmkey, size, IPC_CREAT|IPC_EXCL|<span class="hljs-number">0600</span>);
  <span class="hljs-keyword">if</span> (m_ShmId &lt; <span class="hljs-number">0</span> &amp;&amp; errno != EEXIST) {
    <span class="hljs-keyword">goto</span> ALLOCATE_RESULT;
  }

  <span class="hljs-keyword">if</span>(m_ShmId &lt; <span class="hljs-number">0</span>) {
    m_IsOwner = <span class="hljs-literal">false</span>;
    m_ShmId = ::shmget(shmkey, size, <span class="hljs-number">0600</span>);
  }

  ALLOCATE_RESULT :
    <span class="hljs-keyword">if</span> (m_ShmId &lt; <span class="hljs-number">0</span> ) {
      m_IsOwner = <span class="hljs-literal">false</span>;
      m_ShmId = <span class="hljs-number">-1</span>;
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }

  <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}

<span class="hljs-keyword">void</span> CShmem::<span class="hljs-built_in">free</span>() {
  <span class="hljs-keyword">if</span> (m_ShmId &gt;= <span class="hljs-number">0</span>) {
    <span class="hljs-keyword">if</span> (m_IsOwner) {
      ::shmctl(m_ShmId, IPC_RMID, <span class="hljs-number">0</span>);
    }
    m_ShmId = <span class="hljs-number">-1</span>;
  }
}

<span class="hljs-keyword">void</span> * CShmem::link() {
  <span class="hljs-keyword">if</span> (m_ShmId &gt;= <span class="hljs-number">0</span>) {
    <span class="hljs-keyword">return</span> ::shmat(m_ShmId, (<span class="hljs-keyword">const</span> <span class="hljs-keyword">void</span> *)<span class="hljs-number">0</span>, <span class="hljs-number">0</span>);
  }

  <span class="hljs-keyword">return</span> <span class="hljs-literal">NULL</span>;
}

<span class="hljs-keyword">void</span> CShmem::unlink(<span class="hljs-keyword">void</span> * ptr) {
  <span class="hljs-keyword">if</span> (m_ShmId &gt;= <span class="hljs-number">0</span> &amp;&amp; ptr != <span class="hljs-literal">NULL</span>) {
    ::shmdt(ptr);
  }
}

<span class="hljs-keyword">bool</span> CShmem::isOwner() <span class="hljs-keyword">const</span> {
  <span class="hljs-keyword">return</span> m_IsOwner;
}
</code></pre>
<ul>
<li>2.2 &#x4FE1;&#x53F7;&#x91CF;&#x7C7B;&#x5B9E;&#x73B0;</li>
</ul>
<pre><code class="lang-cpp"><span class="hljs-comment">/* CSemlock&#x5934;&#x6587;&#x4EF6; */</span>

<span class="hljs-keyword">class</span> CSemlock {

  <span class="hljs-keyword">public</span>:

    CSemlock(<span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> * keyfile);
    ~CSemlock();

  <span class="hljs-keyword">public</span>:

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">init</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">final</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">lock</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">unlock</span><span class="hljs-params">()</span></span>;

    <span class="hljs-function"><span class="hljs-keyword">bool</span> <span class="hljs-title">isOwner</span><span class="hljs-params">()</span> <span class="hljs-keyword">const</span></span>;

  <span class="hljs-keyword">private</span>:

    <span class="hljs-keyword">bool</span> m_IsOwner;

    <span class="hljs-keyword">int32_t</span> m_SemId;

    <span class="hljs-built_in">std</span>::<span class="hljs-built_in">string</span> m_Keyfile;
};

<span class="hljs-comment">/* CSemlock */</span>

CSemlock::CSemlock( <span class="hljs-keyword">const</span> <span class="hljs-keyword">char</span> * keyfile )
    : m_IsOwner(<span class="hljs-literal">false</span>),
      m_SemId(<span class="hljs-number">-1</span>),
      m_Keyfile(keyfile)
{}

CSemlock::~CSemlock() {
  m_IsOwner = <span class="hljs-literal">false</span>;
  m_SemId = <span class="hljs-number">-1</span>;
  m_Keyfile.clear();
}

<span class="hljs-keyword">bool</span> CSemlock::init() {
  <span class="hljs-keyword">key_t</span> semkey = <span class="hljs-number">0</span>;

  m_IsOwner = <span class="hljs-literal">true</span>;

  <span class="hljs-keyword">if</span> (!m_Keyfile.empty()) {
    <span class="hljs-keyword">int32_t</span> projectid = (<span class="hljs-keyword">int32_t</span>)HashFunction::djb(m_Keyfile.c_str(), m_Keyfile.length());
    semkey = ::ftok(<span class="hljs-keyword">const_cast</span>&lt;<span class="hljs-keyword">char</span>*&gt;(m_Keyfile.c_str()), projectid);

    <span class="hljs-keyword">if</span>(semkey == <span class="hljs-number">-1</span>) {
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }

    m_SemId = ::semget(semkey, <span class="hljs-number">1</span>, IPC_CREAT|IPC_EXCL|<span class="hljs-number">0600</span>);
    <span class="hljs-keyword">if</span>(m_SemId &lt; <span class="hljs-number">0</span>) {

      <span class="hljs-keyword">if</span>(errno != EEXIST) {
        <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
      }

      m_SemId = ::semget(semkey, <span class="hljs-number">0</span>, <span class="hljs-number">0600</span>);
      <span class="hljs-keyword">if</span> (m_SemId &lt; <span class="hljs-number">0</span>) {
        <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
      }

      m_IsOwner = <span class="hljs-literal">false</span>;
    }
  } <span class="hljs-keyword">else</span> {
    m_SemId = ::semget(IPC_PRIVATE, <span class="hljs-number">1</span>, IPC_CREAT|<span class="hljs-number">0600</span>);
    <span class="hljs-keyword">if</span>(m_SemId &lt; <span class="hljs-number">0</span>) {
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }
  }

  <span class="hljs-keyword">if</span>(m_IsOwner) {
    <span class="hljs-keyword">union</span> semun ick;
    ick.val = <span class="hljs-number">1</span>;

    <span class="hljs-keyword">if</span>(::semctl(m_SemId, <span class="hljs-number">0</span>, SETVAL, ick) &lt; <span class="hljs-number">0</span>) {
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }
  }

  <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}

<span class="hljs-keyword">void</span> CSemlock::final() {
  <span class="hljs-keyword">if</span> (m_IsOwner &amp;&amp; m_SemId != <span class="hljs-number">-1</span>) {
    <span class="hljs-keyword">union</span> semun ick;
    ick.val = <span class="hljs-number">0</span>;
    ::semctl( m_SemId, <span class="hljs-number">0</span>, IPC_RMID, ick );

    m_SemId = <span class="hljs-number">-1</span>;
    m_IsOwner = <span class="hljs-literal">false</span>;
  }

  <span class="hljs-keyword">return</span>;
}

<span class="hljs-keyword">void</span> CSemlock::lock() {
  <span class="hljs-keyword">int32_t</span> rc = <span class="hljs-number">-1</span>;
  <span class="hljs-keyword">struct</span> sembuf sem_on;

  sem_on.sem_num = <span class="hljs-number">0</span>;
  sem_on.sem_op = <span class="hljs-number">-1</span>;
  sem_on.sem_flg = SEM_UNDO;

  <span class="hljs-keyword">do</span> {
    rc = ::semop(m_SemId, &amp;sem_on, <span class="hljs-number">1</span>);
  } <span class="hljs-keyword">while</span> (rc &lt; <span class="hljs-number">0</span> &amp;&amp; errno == EINTR);

  <span class="hljs-keyword">if</span>(rc &lt; <span class="hljs-number">0</span> &amp;&amp; (errno == EIDRM || errno ==EINVAL)) {
    final();
    init();
    lock();
  }

  <span class="hljs-keyword">return</span>;
}

<span class="hljs-keyword">void</span> CSemlock::unlock() {
  <span class="hljs-keyword">int32_t</span> rc = <span class="hljs-number">-1</span>;
  <span class="hljs-keyword">struct</span> sembuf sem_off;

  sem_off.sem_num = <span class="hljs-number">0</span>;
  sem_off.sem_op = <span class="hljs-number">1</span>;
  sem_off.sem_flg = SEM_UNDO;

  <span class="hljs-keyword">do</span> {
    rc = ::semop( m_SemId, &amp;sem_off, <span class="hljs-number">1</span> );
  } <span class="hljs-keyword">while</span> (rc &lt; <span class="hljs-number">0</span> &amp;&amp; errno == EINTR);

  <span class="hljs-keyword">if</span> (rc &lt; <span class="hljs-number">0</span> &amp;&amp; (errno == EIDRM || errno ==EINVAL)){
    final();
    init();
  }

  <span class="hljs-keyword">return</span>;
}

<span class="hljs-keyword">bool</span> CSemlock::isOwner() <span class="hljs-keyword">const</span> {
  <span class="hljs-keyword">return</span> m_IsOwner;
}
</code></pre>
<ul>
<li>2.3 &#x6267;&#x884C;&#x7A0B;&#x5E8F;&#x53CA;&#x6253;&#x5370;&#x7ED3;&#x679C;&#x5982;&#x4E0B;</li>
</ul>
<pre><code class="lang-js">int main(int argc, char ** argv) {

  int32_t i = <span class="hljs-number">0</span>;

  Utils::LogFile logger(<span class="hljs-string">&quot;./data&quot;</span>, <span class="hljs-string">&quot;libuv.server.log&quot;</span>);

  <span class="hljs-keyword">if</span>(!logger.open()) {
    printf(<span class="hljs-string">&quot;open LogFile failed .\n&quot;</span>);
    <span class="hljs-keyword">return</span> <span class="hljs-number">-1</span>;
  }

  printf(<span class="hljs-string">&quot;open LogFile success .\n&quot;</span>);

  logger.setMaxSize(<span class="hljs-number">5</span>*<span class="hljs-number">1024</span>);

  srand(time(NULL));

  <span class="hljs-keyword">for</span>(i = <span class="hljs-number">1</span>; i &lt; <span class="hljs-number">10</span>; ++i) {
    Utils::TimeUtils::sleep(<span class="hljs-number">1000</span>);
    uint8_t level = <span class="hljs-number">1</span> + rand()%<span class="hljs-number">5</span>;
    logger.print(level, <span class="hljs-string">&quot;process one test logfile %d .\n&quot;</span>, i);
  }

  logger.close();

  <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x5206;&#x522B;&#x6267;&#x884C;one&#x4E0E;two&#x4E24;&#x4E2A;&#x8FDB;&#x7A0B; #</span>
./one.out
./two.out
</code></pre>
<p>&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;:</p>
<pre><code class="lang-text">process two test logfile 1 .
process two test logfile 2 .
process two test logfile 3 .
process one test logfile 1 .
process two test logfile 4 .
process one test logfile 2 .
process two test logfile 5 .
process one test logfile 3 .
process two test logfile 6 .
process one test logfile 4 .
process two test logfile 7 .
process one test logfile 5 .
process two test logfile 8 .
process one test logfile 6 .
process two test logfile 9 .
process one test logfile 7 .
process one test logfile 8 .
process one test logfile 9 .
</code></pre>
<ul>
<li>2.4 &#x603B;&#x7ED3;<pre><code class="lang-text">1&#x3001;&#x5171;&#x4EAB;&#x5185;&#x5B58;&#x7684;&#x65B9;&#x5F0F;&#x65B9;&#x4FBF;&#x8FDB;&#x7A0B;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#xFF0C;&#x672C;&#x8EAB;&#x5E76;&#x4E0D;&#x63D0;&#x4F9B;&#x540C;&#x6B65;&#x673A;&#x5236;
2&#x3001;&#x901A;&#x8FC7;&#x501F;&#x52A9;&#x4FE1;&#x53F7;&#x91CF;&#x7684;&#x5F62;&#x5F0F;&#x5B9E;&#x73B0;&#x8FDB;&#x7A0B;&#x5B89;&#x5168;&#x901A;&#x4FE1;&#x7B80;&#x6D01;&#x9AD8;&#x6548;
3&#x3001;&#x5176;&#x4ED6;&#x5F62;&#x5F0F;&#x7684;&#x8FDB;&#x7A0B;&#x901A;&#x4FE1;&#x8BF7;&#x8BFB;&#x8005;&#x81EA;&#x884C;&#x5B9E;&#x73B0;&#xFF0C;&#x5982;&#x7BA1;&#x9053;&#x7B49;
</code></pre>
</li>
</ul>
<hr>
<h3 id="&#x4E09;&#x3001;&#x6E90;&#x7801;">&#x4E09;&#x3001;&#x6E90;&#x7801;</h3>
<ul>
<li><a href="https://github.com/TIME-GATE/libuv-service/blob/master/src/utils/logfile.cc" target="_blank">1&#x3001;&#x8FDB;&#x7A0B;&#x901A;&#x4FE1;&#x6E90;&#x7801;</a> </li>
</ul>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x4E00;&#x84D1;&#x70DF;&#x96E8;&#x4EFB;&#x5E73;&#x751F; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x4FEE;&#x6539;&#x65F6;&#x95F4;: 
2021-04-09 11:09:02
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="oop.html" class="navigation navigation-prev " aria-label="Previous page: 3.2.1 面向对象">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="thread.html" class="navigation navigation-next " aria-label="Next page: 3.2.3 线程管理">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.2.2 进程通信","level":"1.3.3.2.2","depth":4,"next":{"title":"3.2.3 线程管理","level":"1.3.3.2.3","depth":4,"path":"program/c/thread.md","ref":"program/c/thread.md","articles":[]},"previous":{"title":"3.2.1 面向对象","level":"1.3.3.2.1","depth":4,"path":"program/c/oop.md","ref":"program/c/oop.md","articles":[]},"dir":"ltr"},"config":{"plugins":["disqus","tree","splitter","local-video","chart","github-buttons","tbfed-pagefooter","ace","katex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 一蓑烟雨任平生","modify_label":"修改时间: ","modify_format":"YYYY-MM-DD HH:mm:ss"},"disqus":{"useIdentifier":false,"shortName":"gitbookuse"},"ace":{},"splitter":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"github-buttons":{"repo":"TIME-GATE/","types":["star","watch"],"size":"large"},"local-video":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"tree":{},"chart":{"type":"c3"}},"theme":"default","author":"zq_sdk@163.com","name":"name","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Ebook","language":"zh-hans","gitbook":"*","description":"电子书"},"file":{"path":"program/c/ipcs.md","mtime":"2021-04-09T03:09:02.277Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-10T12:23:44.633Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-tree/jquery.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-tree/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

